

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>MDS Cache Configuration &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="MDS 配置参考" href="../mds-config-ref/" />
    <link rel="prev" title="术语" href="../standby/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 文件系统</a> &raquo;</li>
        
      <li>MDS Cache Configuration</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephfs/cache-configuration.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 文件系统</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#cephfs">CephFS 入门</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id4">管理</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../createfs/"> 创建 CephFS 文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../administration/"> 管理命令</a></li>
<li class="toctree-l3"><a class="reference internal" href="../multifs/"> 创建多个文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-remove-mds/"> 配备、增加、删除 MDS</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/">术语</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds">MDS 守护进程的引用</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#id3">故障切换的管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds-standby-replay">热备的配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds-join-fs">配置 MDS 与文件系统的亲和性</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"> MDS 缓存配置</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#mds-cache-size">MDS Cache Size</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mds-cache-trimming">MDS Cache Trimming</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mds-recall">MDS Recall</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mds-cap-acquisition-throttle">MDS Cap Acquisition Throttle</a></li>
<li class="toctree-l4"><a class="reference internal" href="#session-liveness">Session Liveness</a></li>
<li class="toctree-l4"><a class="reference internal" href="#capability-limit">Capability Limit</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../mds-config-ref/"> MDS 配置选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/ceph-mds/"> ceph-mds 手册页</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nfs/"> 通过 NFS 导出</a></li>
<li class="toctree-l3"><a class="reference internal" href="../app-best-practices/"> 应用最佳实践</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fs-volumes/"> FS 卷和子卷</a></li>
<li class="toctree-l3"><a class="reference internal" href="../quota/"> CephFS 配额管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-messages/"> 健康消息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/">升级 MDS 集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/#firefly-jewel">升级比 Firefly 老的文件系统，需过 Jewel 这个槛</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-top/"> CephFS Top 工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../snap-schedule/"> 定时快照</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-mirroring/"> CephFS 快照镜像</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#id5">挂载 CephFS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id6">CephFS 内幕</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id7">故障排除和灾难恢复</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id9">更多细节</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="mds-cache-configuration">
<h1>MDS Cache Configuration<a class="headerlink" href="#mds-cache-configuration" title="Permalink to this headline">¶</a></h1>
<p>The Metadata Server coordinates a distributed cache among all MDS and CephFS
clients. The cache serves to improve metadata access latency and allow clients
to safely (coherently) mutate metadata state (e.g. via <cite>chmod</cite>). The MDS issues
<strong>capabilities</strong> and <strong>directory entry leases</strong> to indicate what state clients
may cache and what manipulations clients may perform (e.g. writing to a file).</p>
<p>The MDS and clients both try to enforce a cache size. The mechanism for
specifying the MDS cache size is described below. Note that the MDS cache size
is not a hard limit. The MDS always allows clients to lookup new metadata
which is loaded into the cache. This is an essential policy as it avoids
deadlock in client requests (some requests may rely on held capabilities before
capabilities are released).</p>
<p>When the MDS cache is too large, the MDS will <strong>recall</strong> client state so cache
items become unpinned and eligible to be dropped. The MDS can only drop cache
state when no clients refer to the metadata to be dropped. Also described below
is how to configure the MDS recall settings for your workload’s needs. This is
necessary if the internal throttles on the MDS recall can not keep up with the
client workload.</p>
<div class="section" id="mds-cache-size">
<h2>MDS Cache Size<a class="headerlink" href="#mds-cache-size" title="Permalink to this headline">¶</a></h2>
<p>You can limit the size of the Metadata Server (MDS) cache by a byte count. This
is done through the <cite>mds_cache_memory_limit</cite> configuration:</p>
<dl class="std confval">
<dt id="confval-mds_cache_memory_limit">
<code class="sig-name descname"><span class="pre">mds_cache_memory_limit</span></code><a class="headerlink" href="#confval-mds_cache_memory_limit" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>This sets a target maximum memory usage of the MDS cache and is the
primary tunable to limit the MDS memory usage. The MDS will try to
stay under a reservation of this limit (by default 95%; 1 -
mds_cache_reservation) by trimming unused metadata in its cache and
recalling cached items in the client caches. It is possible for the
MDS to exceed this limit due to slow recall from clients. The
mds_health_cache_threshold (150%) sets a cache full threshold for when
the MDS signals a cluster health warning.</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">4Gi</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>In addition, you can specify a cache reservation by using the
<cite>mds_cache_reservation</cite> parameter for MDS operations:</p>
<dl class="std confval">
<dt id="confval-mds_cache_reservation">
<code class="sig-name descname"><span class="pre">mds_cache_reservation</span></code><a class="headerlink" href="#confval-mds_cache_reservation" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>MDS 缓存（子系统）要维持的保留缓存空间（内存量或 inode 数量）。 MDS 一旦开始恢复其缓存保留量， 它会回调客户端状态，
直到它的缓存尺寸也缩减到空出保留值。</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0.05</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>The cache reservation is
limited as a percentage of the memory and is set to 5% by default. The intent
of this parameter is to have the MDS maintain an extra reserve of memory for
its cache for new metadata operations to use. As a consequence, the MDS should
in general operate below its memory limit because it will recall old state from
clients in order to drop unused metadata in its cache.</p>
<p>If the MDS cannot keep its cache under the target size, the MDS will send a
health alert to the Monitors indicating the cache is too large. This is
controlled by the <cite>mds_health_cache_threshold</cite> configuration which is by
default 150% of the maximum cache size:</p>
<dl class="std confval">
<dt id="confval-mds_health_cache_threshold">
<code class="sig-name descname"><span class="pre">mds_health_cache_threshold</span></code><a class="headerlink" href="#confval-mds_health_cache_threshold" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>threshold for cache size to generate health warning</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1.5</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>Because the cache limit is not a hard limit, potential bugs in the CephFS
client, MDS, or misbehaving applications might cause the MDS to exceed its
cache size. The health warnings are intended to help the operator detect this
situation and make necessary adjustments or investigate buggy clients.</p>
</div>
<div class="section" id="mds-cache-trimming">
<h2>MDS Cache Trimming<a class="headerlink" href="#mds-cache-trimming" title="Permalink to this headline">¶</a></h2>
<p>There are two configurations for throttling the rate of cache trimming in the MDS:</p>
<dl class="std confval">
<dt id="confval-mds_cache_trim_threshold">
<code class="sig-name descname"><span class="pre">mds_cache_trim_threshold</span></code><a class="headerlink" href="#confval-mds_cache_trim_threshold" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>threshold for number of dentries that can be trimmed</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">256Ki</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-mds_cache_trim_decay_rate">
<code class="sig-name descname"><span class="pre">mds_cache_trim_decay_rate</span></code><a class="headerlink" href="#confval-mds_cache_trim_decay_rate" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>decay rate for trimming MDS cache throttle</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>The intent of the throttle is to prevent the MDS from spending too much time
trimming its cache. This may limit its ability to handle client requests or
perform other upkeep.</p>
<p>The trim configurations control an internal <strong>decay counter</strong>. Anytime metadata
is trimmed from the cache, the counter is incremented.  The threshold sets the
maximum size of the counter while the decay rate indicates the exponential half
life for the counter. If the MDS is continually removing items from its cache,
it will reach a steady state of <code class="docutils literal notranslate"><span class="pre">-ln(0.5)/rate*threshold</span></code> items removed per
second.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Increasing the value of the configuration setting
<code class="docutils literal notranslate"><span class="pre">mds_cache_trim_decay_rate</span></code> leads to the MDS spending less time
trimming the cache. To increase the cache trimming rate, set a lower
value.</p>
</div>
<p>The defaults are conservative and may need to be changed for production MDS with
large cache sizes.</p>
</div>
<div class="section" id="mds-recall">
<h2>MDS Recall<a class="headerlink" href="#mds-recall" title="Permalink to this headline">¶</a></h2>
<p>MDS limits its recall of client state (capabilities/leases) to prevent creating
too much work for itself handling release messages from clients. This is controlled
via the following configurations:</p>
<p>The maximum number of capabilities to recall from a single client in a given recall
event:</p>
<dl class="std confval">
<dt id="confval-mds_recall_max_caps">
<code class="sig-name descname"><span class="pre">mds_recall_max_caps</span></code><a class="headerlink" href="#confval-mds_recall_max_caps" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>maximum number of caps to recall from client session in single recall</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">30000B</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>The threshold and decay rate for the decay counter on a session:</p>
<dl class="std confval">
<dt id="confval-mds_recall_max_decay_threshold">
<code class="sig-name descname"><span class="pre">mds_recall_max_decay_threshold</span></code><a class="headerlink" href="#confval-mds_recall_max_decay_threshold" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>decay threshold for throttle on recalled caps on a session</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">128Ki</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-mds_recall_max_decay_rate">
<code class="sig-name descname"><span class="pre">mds_recall_max_decay_rate</span></code><a class="headerlink" href="#confval-mds_recall_max_decay_rate" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>decay rate for throttle on recalled caps on a session</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1.5</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>The session decay counter controls the rate of recall for an individual
session. The behavior of the counter works the same as for cache trimming
above. Each capability that is recalled increments the counter.</p>
<p>There is also a global decay counter that throttles for all session recall:</p>
<dl class="std confval">
<dt id="confval-mds_recall_global_max_decay_threshold">
<code class="sig-name descname"><span class="pre">mds_recall_global_max_decay_threshold</span></code><a class="headerlink" href="#confval-mds_recall_global_max_decay_threshold" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>decay threshold for throttle on recalled caps globally</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">128Ki</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>its decay rate is the same as <code class="docutils literal notranslate"><span class="pre">mds_recall_max_decay_rate</span></code>. Any recalled
capability for any session also increments this counter.</p>
<p>If clients are slow to release state, the warning “failing to respond to cache
pressure” or <code class="docutils literal notranslate"><span class="pre">MDS_HEALTH_CLIENT_RECALL</span></code> will be reported. Each session’s rate
of release is monitored by another decay counter configured by:</p>
<dl class="std confval">
<dt id="confval-mds_recall_warning_threshold">
<code class="sig-name descname"><span class="pre">mds_recall_warning_threshold</span></code><a class="headerlink" href="#confval-mds_recall_warning_threshold" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>decay threshold for warning on slow session cap recall</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">256Ki</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-mds_recall_warning_decay_rate">
<code class="sig-name descname"><span class="pre">mds_recall_warning_decay_rate</span></code><a class="headerlink" href="#confval-mds_recall_warning_decay_rate" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>decay rate for warning on slow session cap recall</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">60.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>Each time a capability is released, the counter is incremented.  If clients do
not release capabilities quickly enough and there is cache pressure, the
counter will indicate if the client is slow to release state.</p>
<p>Some workloads and client behaviors may require faster recall of client state
to keep up with capability acquisition. It is recommended to increase the above
counters as needed to resolve any slow recall warnings in the cluster health
state.</p>
</div>
<div class="section" id="mds-cap-acquisition-throttle">
<h2>MDS Cap Acquisition Throttle<a class="headerlink" href="#mds-cap-acquisition-throttle" title="Permalink to this headline">¶</a></h2>
<p>A trivial “find” command on a large directory hierarchy will cause the client
to receive caps significantly faster than it will release. The MDS will try
to have the client reduce its caps below the <code class="docutils literal notranslate"><span class="pre">mds_max_caps_per_client</span></code> limit
but the recall throttles prevent it from catching up to the pace of acquisition.
So the readdir is throttled to control cap acquisition via the following
configurations:</p>
<p>The threshold and decay rate for the readdir cap acquisition decay counter:</p>
<dl class="std confval">
<dt id="confval-mds_session_cap_acquisition_throttle">
<code class="sig-name descname"><span class="pre">mds_session_cap_acquisition_throttle</span></code><a class="headerlink" href="#confval-mds_session_cap_acquisition_throttle" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>throttle point for cap acquisition decay counter</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">uint</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">500000</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-mds_session_cap_acquisition_decay_rate">
<code class="sig-name descname"><span class="pre">mds_session_cap_acquisition_decay_rate</span></code><a class="headerlink" href="#confval-mds_session_cap_acquisition_decay_rate" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>The half-life for the session cap acquisition counter of caps acquired
by readdir. This is used for throttling readdir requests from clients
slow to release caps.</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">10.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>The cap acquisition decay counter controls the rate of cap acquisition via
readdir. The behavior of the decay counter is the same as for cache trimming or
caps recall. Each readdir call increments the counter by the number of files in
the result.</p>
<p>The ratio of <code class="docutils literal notranslate"><span class="pre">mds_max_caps_per_client</span></code> that client must exceed before readdir
maybe throttled by cap acquisition throttle:</p>
<dl class="std confval">
<dt id="confval-mds_session_max_caps_throttle_ratio">
<code class="sig-name descname"><span class="pre">mds_session_max_caps_throttle_ratio</span></code><a class="headerlink" href="#confval-mds_session_max_caps_throttle_ratio" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>ratio of mds_max_caps_per_client that client must exceed before
readdir may be throttled by cap acquisition throttle</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1.1</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>The timeout in seconds after which a client request is retried due to cap
acquisition throttling:</p>
<dl class="std confval">
<dt id="confval-mds_cap_acquisition_throttle_retry_request_timeout">
<code class="sig-name descname"><span class="pre">mds_cap_acquisition_throttle_retry_request_timeout</span></code><a class="headerlink" href="#confval-mds_cap_acquisition_throttle_retry_request_timeout" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>timeout in seconds after which a client request is retried due to cap
acquisition throttling</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0.5</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>If the number of caps acquired by the client per session is greater than the
<code class="docutils literal notranslate"><span class="pre">mds_session_max_caps_throttle_ratio</span></code> and cap acquisition decay counter is
greater than <code class="docutils literal notranslate"><span class="pre">mds_session_cap_acquisition_throttle</span></code>, the readdir is throttled.
The readdir request is retried after <code class="docutils literal notranslate"><span class="pre">mds_cap_acquisition_throttle_retry_request_timeout</span></code>
seconds.</p>
</div>
<div class="section" id="session-liveness">
<h2>Session Liveness<a class="headerlink" href="#session-liveness" title="Permalink to this headline">¶</a></h2>
<p>The MDS also keeps track of whether sessions are quiescent. If a client session
is not utilizing its capabilities or is otherwise quiet, the MDS will begin
recalling state from the session even if it’s not under cache pressure. This
helps the MDS avoid future work when the cluster workload is hot and cache
pressure is forcing the MDS to recall state. The expectation is that a client
not utilizing its capabilities is unlikely to use those capabilities anytime
in the near future.</p>
<p>Determining whether a given session is quiescent is controlled by the following
configuration variables:</p>
<dl class="std confval">
<dt id="confval-mds_session_cache_liveness_magnitude">
<code class="sig-name descname"><span class="pre">mds_session_cache_liveness_magnitude</span></code><a class="headerlink" href="#confval-mds_session_cache_liveness_magnitude" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>This is the order of magnitude difference (in base 2) of the internal
liveness decay counter and the number of capabilities the session
holds. When this difference occurs, the MDS treats the session as
quiescent and begins recalling capabilities.</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">size</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">10B</span></code></p>
</dd>
<dt class="field-odd">see also</dt>
<dd class="field-odd"><p><a class="reference internal" href="#confval-mds_session_cache_liveness_decay_rate"><code class="xref std std-confval docutils literal notranslate"><span class="pre">mds_session_cache_liveness_decay_rate</span></code></a></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-mds_session_cache_liveness_decay_rate">
<code class="sig-name descname"><span class="pre">mds_session_cache_liveness_decay_rate</span></code><a class="headerlink" href="#confval-mds_session_cache_liveness_decay_rate" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>This determines how long a session needs to be quiescent before the
MDS begins preemptively recalling capabilities. The default of 5
minutes will cause 10 halvings of the decay counter after 1 hour, or
1/1024. The default magnitude of 10 (1^10 or 1024) is chosen so that
the MDS considers a previously chatty session (approximately) to be
quiescent after 1 hour.</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">5</span> <span class="pre">minutes</span></code></p>
</dd>
<dt class="field-odd">see also</dt>
<dd class="field-odd"><p><a class="reference internal" href="#confval-mds_session_cache_liveness_magnitude"><code class="xref std std-confval docutils literal notranslate"><span class="pre">mds_session_cache_liveness_magnitude</span></code></a></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>The configuration <code class="docutils literal notranslate"><span class="pre">mds_session_cache_liveness_decay_rate</span></code> indicates the
half-life for the decay counter tracking the use of capabilities by the client.
Each time a client manipulates or acquires a capability, the MDS will increment
the counter. This is a rough but effective way to monitor the utilization of the
client cache.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">mds_session_cache_liveness_magnitude</span></code> is a base-2 magnitude difference
of the liveness decay counter and the number of capabilities outstanding for
the session. So if the client has <code class="docutils literal notranslate"><span class="pre">1*2^20</span></code> (1M) capabilities outstanding and
only uses <strong>less</strong> than <code class="docutils literal notranslate"><span class="pre">1*2^(20-mds_session_cache_liveness_magnitude)</span></code> (1K
using defaults), the MDS will consider the client to be quiescent and begin
recall.</p>
</div>
<div class="section" id="capability-limit">
<h2>Capability Limit<a class="headerlink" href="#capability-limit" title="Permalink to this headline">¶</a></h2>
<p>The MDS also tries to prevent a single client from acquiring too many
capabilities. This helps prevent recovery from taking a long time in some
situations.  It is not generally necessary for a client to have such a large
cache. The limit is configured via:</p>
<dl class="std confval">
<dt id="confval-mds_max_caps_per_client">
<code class="sig-name descname"><span class="pre">mds_max_caps_per_client</span></code><a class="headerlink" href="#confval-mds_max_caps_per_client" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>maximum number of capabilities a client may hold</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">uint</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">1Mi</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<p>It is not recommended to set this value above 5M but it may be helpful with
some workloads.</p>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../mds-config-ref/" class="btn btn-neutral float-right" title="MDS 配置参考" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../standby/" class="btn btn-neutral float-left" title="术语" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>